Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug: When using dynamic linking, auth will be loaded repeatedly. #27

Merged
merged 27 commits into from
Dec 19, 2023

Conversation

joii2020
Copy link
Collaborator

@joii2020 joii2020 commented Dec 8, 2023

  • ckb-auth-rs: Add features to control dynamic linking and CKBDLContext in static memory
  • C language: supports dynamic loading of multiple ckb-auth
  • Fix bug: When using dynamic linking, auth will be loaded repeatedly.
  • Update tests/README.md

c/ckb_auth.h Outdated
@@ -120,19 +120,24 @@ typedef int (*ckb_auth_validate_t)(uint8_t auth_algorithm_id,
uint32_t pubkey_hash_size);

static uint8_t g_code_buff[300 * 1024] __attribute__((aligned(RISCV_PGSIZE)));
static void* g_code_handle;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

init it to zero.

tests/auth-c-lock/auth_c_lock.c Show resolved Hide resolved
@joii2020 joii2020 changed the title Fix bug: When using dynamic linking, auth will be loaded repeatedly. [WIP] Fix bug: When using dynamic linking, auth will be loaded repeatedly. Dec 11, 2023
@@ -9,8 +9,14 @@ edition = "2021"
default = []
ckb2023 = ["ckb-std/ckb2023"]

enable-dynamic-library = ["lazy_static"]
dynamic-library-memory-200 = ["enable-dynamic-library"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use this feature as default.

@@ -9,8 +9,14 @@ edition = "2021"
default = []
ckb2023 = ["ckb-std/ckb2023"]

enable-dynamic-library = ["lazy_static"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use this feature as default

@joii2020 joii2020 changed the title [WIP] Fix bug: When using dynamic linking, auth will be loaded repeatedly. Fix bug: When using dynamic linking, auth will be loaded repeatedly. Dec 13, 2023
Comment on lines +166 to +168
if (buf_offset % RISCV_PGSIZE != 0) {
buf_offset += RISCV_PGSIZE - buf_offset % RISCV_PGSIZE;
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

double check it.

@XuJiandong XuJiandong merged commit f381f9b into nervosnetwork:main Dec 19, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants